package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 梦龙
 * @date 2023/11/29 10:17
 */
@Mapper
public interface SetMealDishMapper {

    /**
     * @description:根据菜品id查询对应的套餐id
     * @return: java.util.List<java.lang.Long>
     * @author: 梦龙
     * @time: 2023/11/29 10:19
     */
    List<Long> getSetMealIdByDishIds(List<Long> dishIds);

    /**
     * @description:根据套餐id集删除套餐-菜品表中的数据
     * @return: void
     * @author: 梦龙
     * @time: 2023/11/29 10:31
     */
//    @Delete("delete from dish where id = #{id}")
    void deleteByIds(List<Long> setmealIds);

    /**
     * @description:创建菜品-套餐关联数据
     * @return: void
     * @author: 梦龙
     * @time: 2023/11/30 11:03
     */
    void insert(List<SetmealDish> dishes);

    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> getDishBySetmealId(Long id);
}
